<?php
echo "<br><div>";
    echo $this->element('menu_resume');
    echo $this->element('myfunction'); 
    
    //$complete = $fields = $this->requestAction(array('controller'=>'jobseekers','action'=>'complete_all'));
    //$complete_summary = $fields = $this->requestAction(array('controller'=>'jobseekers','action'=>'complete_summary'));
    //$complete_personal = $fields = $this->requestAction(array('controller'=>'jobseekers','action'=>'complete_personal'));

    if($complete)
    {
            //var_dump($data);
            $detail = $data['Jobseeker'];          
            $resume = $data['Resume'];
            $city = $data['City'];
            $religion = $data['Religion'];
            $languages = $data['Language'];
            $skills = $data['Skill'];
            $educations = $data['Education'];
            $works = $data['Work'];
                
            if($resume['upload_photo']!='')
            {
                echo $html->image('../'.$resume['upload_photo']);
            }    
            echo "<br>";
            echo "<b>".$detail['salution']." ".$detail['last_name'].", ".$detail['first_name']."</b>";    
            echo "<p align='right'><i> Last Update : ".mydate($resume['modified'])."</i></p>";
            
            echo "<br><span class='judul'>Personal Detailsnya</span>";
            echo "<table>";
            echo "<tr>";
            echo "<td><span class='label'>First Name</span></td>";
            echo "<td><span class='isi'>".$detail['first_name']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Last Name</span></td>";
            echo "<td><span class='isi'>".$detail['last_name']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Nasionalism</span></td>";
            echo "<td><span class='isi'>".$detail['nasionalism']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Gender</span></td>";
            echo "<td><span class='isi'>".$detail['gender']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Date of Birth</span></td>";
            echo "<td><span class='isi'>".mydate($detail['date_of_birth'])."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Martial Status</span></td>";
            echo "<td><span class='isi'>".$detail['martial_status']."</span></td>";
            echo "</tr>";
            echo "</table>";
            
            echo "<br><span class='judul'>Contact Details</span>";
            echo "<table>";
            echo "<tr>";
            echo "<td><span class='label'>Address</span></td>";
            echo "<td><span class='isi'>".$detail['address'].", ".$city['name']." ".$detail['postal_code']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Telephone No.</span></td>";
            echo "<td><span class='isi'>".$detail['home_no']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Mobile No.</span></td>";
            echo "<td><span class='isi'>".$detail['mobile_no']."</span></td>";
            echo "</tr>"; 
            echo "<tr>";
            echo "<td><span class='label'>Email</span></td>";
            echo "<td><span class='isi'>".$detail['email']."</span></td>";
            echo "</tr>";             
            echo "</table>";


            echo "<br><span class='judul'>Education History</span>";
            echo "<table class='table'>";
            echo "<tr><th>Period</th><th>school</th><th>location</th><th>qualification</th><th>major</th><th>grade</th></tr>";
            foreach($educations as $temp)
            {
                echo "<tr>";
                    echo "<td>".$temp['start_period']." - ";
                    echo $temp['end_period']."</td>";
                    echo "<td>".$temp['school']."</td>";
                    echo "<td>".$temp['location']."</td>";
                    echo "<td>".$temp['qualification']."</td>";
                    echo "<td>".$temp['major']."</td>";
                    echo "<td>".$temp['grade']."</td>";
                echo "</tr>";
            }
            echo "</table>";
            echo "<span class='label'>Certificate</span><br>";
            echo "<span class='isi'>".$resume['certificate']."</span><br>";
            
               
            echo "<br><span class='judul'>Skills</span>";
            echo "<table class='table'>";
            echo "<tr><th>Skill</th><th>Proficiency</th><th>Year</th></tr>";
            foreach($skills as $temp)
            {
                echo "<tr>";
                    echo "<td>".$temp['name']."</td>";
                    echo "<td>".$temp['proficiency']."</td>";
                    echo "<td>".$temp['year']."</td>";
                echo "</tr>";
            }
            echo "</table>";

            
            echo "<br><span class='judul'>Work Experience</span>";
            echo "<table class='table' border=1>";
            echo "<tr><th>Period</th><th>company</th><th>position</th><th>salary</th></tr>";
            foreach($works as $temp)
            {
                echo "<tr>";
                    echo "<td>".$temp['start_month']." ".$temp['start_year']." - ";
                    echo $temp['end_month']." ".$temp['end_year']."</td>";
                    echo "<td>".$temp['company']."</td>";
                    echo "<td>".$temp['position']."</td>";
                    echo "<td>".$temp['salary']."</td>";
                echo "</tr>";
                echo "<tr>";
                    echo "<td colspan=4>duties : ";
                    echo "<p>".$temp['duties']."</p></td>";
                echo "</tr>";
            }
            echo "</table>";
            
                
            echo "<br><span class='judul'>Languages</span>";
            echo "<table class='table' border=1>";
            echo "<tr><th>Language</th><th>Speak</th><th>Listen</th><th>Write</th><th>Read</th></tr>";
            foreach($languages as $temp)
            {
                echo "<tr>";
                    echo "<td>".$temp['name']."</td>";
                    echo "<td>".$temp['speak']."</td>";
                    echo "<td>".$temp['listen']."</td>";
                    echo "<td>".$temp['write']."</td>";
                    echo "<td>".$temp['read']."</td>";
                echo "</tr>";
            }
            echo "</table>";    
            echo "<br><span class='judul'>Miscellanous & Summary</span>";
            echo "<table>";
            echo "<tr>";
            echo "<td><span class='label'>Highest Academic</span></td>";
            echo "<td><span class='isi'>".$academic[0]['Academic']['name']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Score</span></td>";
            echo "<td><span class='isi'>".$resume['score']."</span></td>";
            echo "</tr>";
            echo "<tr>";
            echo "<td><span class='label'>Avaibility</span></td>";
            if($resume['avaibility']==0)    
            { echo "<td><span class='isi'>Avaible</span></td>"; }
            if($resume['avaibility']==1)    
            { echo "<td><span class='isi'>Avaible after ".mydate($resume['date_avaible'])."</span></td>"; }
            if($resume['avaibility']==2)    
            { echo "<td><span class='isi'>Not Avaible right now</span></td>"; }
            echo "</tr>"; 
            echo "<tr>";
            echo "<td><span class='label'>Working Experience</span></td>";
            if($resume['work_exp']==0)    
            { echo "<td><span class='isi'> Still School</span></td>"; }
            if($resume['work_exp']==1)    
            { echo "<td><span class='isi'> Fresh Graduate</span></td>"; }
            if($resume['work_exp']==2)    
            { echo "<td><span class='isi'> Have worked for ".$resume['month_exp']." month(s), ".$resume['year_exp']." year(s)</span></td>"; }
            echo "</tr>";             
            echo "<tr>";
            echo "<td><span class='label'>Expected Salary</span></td>";
            echo "<td><span class='isi'> Rp.".$resume['salary']."</span></td>";
            echo "</tr>";             
            echo "<tr>";
            echo "<td><span class='label'>Posseses Vehicle</span></td>";
            echo "<td><span class='isi'>".$resume['vehicle']."</span></td>";
            echo "</tr>";             
            echo "<tr>";
            echo "<td><span class='label'>Wiliing to travel</span></td>";
            echo "<td><span class='isi'>".$resume['travel']."</span></td>";
            echo "</tr>";             
            echo "<tr>";
            echo "<td><span class='label'>Willing to relocate</span></td>";
            echo "<td><span class='isi'>".$resume['relocate']."</span></td>";
            echo "</tr>";             
            echo "<tr>";
            echo "<td><span class='label'>Willing to overseas</span></td>";
            echo "<td><span class='isi'>".$resume['overseas']."</span></td>";
            echo "</tr>";             
                   
            echo "</table>";    
             echo "<span class='label'>Self Description</span><br>";
            echo "<span class='isi'>".$resume['self_desc']."</span><br>";   

    }
    else
    {
        echo "You havent finished create your resume";
        
        if(!$complete_personal)
        { echo $html->link('Personal Detail',array('controller'=>'jobseekers','action'=>'personal_detail')); }
        if(!$complete_summary)
        { echo $html->link('Summary Resume',array('controller'=>'resumes','action'=>'summary')); }
        
    }

echo "</div>";
?>
